package com.lantosec.hmrp.modules.system.entity;

import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class TestBean {
    public List<Map<String, Object>> loadReportData(String dsName, String datasetName, Map<String, Object> parameters) {

        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

        for (int i = 0; i < 1000; i++) {

            // 模拟数据

            Map<String, Object> m = new HashMap<String, Object>();

            m.put("id", i);

            m.put("name", RandomStringUtils.random(10, true, false));

            m.put("salary", RandomUtils.nextInt() + i);

            list.add(m);

        }

        return list;

    }



    /**

     * @return 对象类型 ,类型：com.bstek.ureport.test.demo.User

     */

    public List<SysUser> buildReport(String dsName, String datasetName, Map<String, Object> parameters) {

        List<SysUser> list = new ArrayList<SysUser>();

        for (int i = 0; i < 1000; i++) {

            SysUser m = new SysUser();

            m.setUserId(String.valueOf(i));

            m.setName(RandomStringUtils.random(10, true, false));

           // m.setSalary(RandomUtils.nextInt() + i);

            list.add(m);

        }

        return list;

    }
}
